package com.lipaluma.test.util;

import java.util.Map;
import java.util.Map.Entry;

import org.springframework.test.util.ReflectionTestUtils;

import com.lipaluma.xml.mapping.XmlColumnMapping;
import com.lipaluma.xml.mapping.XmlPathMapping;

public class XmlMappingUtils {
	
	public static XmlColumnMapping createXmlColumn(Map<String, Object> params) {
		XmlColumnMapping mapping = new XmlColumnMapping();
		for(Entry<String, Object> entry : params.entrySet()) {
			ReflectionTestUtils.setField(mapping, entry.getKey(), entry.getValue());
		}
		return mapping;
	}

	public static XmlPathMapping createXmlPath(Map<String, Object> params) {
		XmlPathMapping mapping = new XmlPathMapping();
		for(Entry<String, Object> entry : params.entrySet()) {
			ReflectionTestUtils.setField(mapping, entry.getKey(), entry.getValue());
		}
		return mapping;
	}

}
